<?php

class usertop extends adminControl
{
	protected function indexAction()
	{
		$pagesize = 20;
		$page = $_GET['page'] >=1 ? intval($_GET['page']) : 1;
		$start = ($page - 1)*$pagesize;
		
		if (isset($_GET['groupid']))
		{
			$where = ' WHERE groupid = ' . intval($_GET['groupid']);
		}
		$order = isset($_GET['order']) ? $_GET['order'] : 'postnum';

		$rs = $this->db->get_one("SELECT COUNT(*) AS total FROM cms_user $where");
		$count = $rs['total'];
		$numofpage = ceil($count/$pagesize);

		$pages = numofpage($count, $page, $numofpage, "$basename&order=$order");

		$admindb = $this->db->get_array("SELECT * FROM cms_user $where ORDER BY $order DESC LIMIT $start, $pagesize");

		$this->fillData('count', $count);
		$this->fillData('pages', $pages);
		$this->fillData('admindb', $admindb);
		$this->display('usertop');
	}

}

new usertop();
?>